clear all; close all; clc;
R=120;
C=33e-12;
L=100e-6;

Uc(1) = 0; 
i(1) = 0; 
tau=R*C;
T=tau/100;
t=0:T:(100*tau);
N=length(t);
omega0=1e8;
S(1)=sin(T*omega0);


for k=2:N;
        S(k)=sin(k*T*omega0);
        Uc(k)=Uc(k-1)+i(k-1)*T/C;
 i(k)=(S(k)*T+L*i(k-1)-Uc(k)*T)/(L+R*T);
 Ur(k)=i(k)*R;
    end;
    
figure(1)
plot(t,S,t,Ur)
xlabel('t, ns')
ylabel('U_r, S, Volt')
legend('Ur(t)', 'S(t)')
grid on
figure(2);
plot(t,Ur)
xlabel('t, ns')
ylabel('U_r,  Volt')
legend('Ur(t)')
grid on


